package com.music.service.members.service;

import java.util.Date;

import org.springframework.beans.factory.annotation.Required;

import com.music.service.members.beans.Member;
import com.music.service.members.constants.Gender;
import com.music.service.members.dao.MemberDAO;

public class MemberServiceImpl implements MemberService{
	private MemberDAO mMemberDAO;

	
	
	/**
	 * @return the memberDAO
	 */
	public MemberDAO getMemberDAO() {
		return mMemberDAO;
	}

	/**
	 * @param pMemberDAO the memberDAO to set
	 */
	@Required
	public void setMemberDAO(MemberDAO pMemberDAO) {
		mMemberDAO = pMemberDAO;
	}

	public Member createMember(String firstName, String lastName,
			String password, Date birthDate, Gender gender, String email) throws Exception {
		return mMemberDAO.createMember(firstName, lastName, password, birthDate, gender, email);
	}

	public boolean deleteMember(Long memberId) {
		return mMemberDAO.deleteMember(memberId);
	}

	public Member getMember(Long memberId) {
		return mMemberDAO.getMember(memberId);
	}

	public boolean updateMember(Member member) {
		return mMemberDAO.updateMember(member);
	}

	@Override
	public Member getMember(String pEmailId) {
		
		return getMemberDAO().getMember(pEmailId);
	}

	@Override
	public Member getMember(String pEmailId, boolean pAutoCreate)
			throws Exception {
		return getMemberDAO().getMember(pEmailId, pAutoCreate);
	}

	

		
}
